using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.Reflection;
using System.Security.Permissions;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Data;
using System.Data.Odbc;
using NumericalRecipes;
using FftLib;
using BmgNet;
using StaticUtility;

namespace ObjectLib
{
	#region PixelScrambler -- Never Used
	/*
	public class PixelScrambler
	{
		private static int[] scrambledIndices;
		public float[,,] PixelValues;
		public Rectangle Bound;
		public float[,,] Result;
		public PixelScrambler(float[,,] PixelValues, Rectangle Bound)
		{
			this.PixelValues = PixelValues;
			this.Bound = Bound;
			Scramble();
		}
		public void Scramble()
		{
			int depth = PixelValues.GetLength(2);
			int length = Bound.Width*Bound.Height;
			if(scrambledIndices==null || scrambledIndices.Length < length)
				scrambledIndices = new int[length*2];

			Util.RandVec(length, 0, scrambledIndices);

			if( Result==null || Result.GetLength(0)!=Bound.Height || Result.GetLength(1)!=Bound.Width || Result.GetLength(2)!=depth)
				Result = new float[Bound.Height, Bound.Width, depth];

			int i,j,ind,ii,jj,k;
			for(i=0; i<Bound.Height; i++)
				for(j=0; j<Bound.Width; j++)
				{
					ind= scrambledIndices[i*Bound.Width + j];
					ii = ind/Bound.Width;
					jj = ind-ii;
					for(k=0; k<depth; k++)
						Result[i,j,k] = PixelValues[Bound.Top+ii, Bound.Left+jj, k];
				}
		}
	}
	*/
	#endregion
	public enum ContourType
	{
		Unknown,
		Shadow,
		Texture
	};
	[Serializable]
	public class ObjectData : ISerializable
	{
		public string Name;
		public string[] SearchText;
		public int ActivePolyInd;
		public PolygonFlist Polygons;
		public CategoryNode Category;
		public ObjectData() {}
		public ObjectData(SerializationInfo info, StreamingContext context)
		{
			Name = info.GetString("Name");
			SearchText = new string[0];
			ActivePolyInd = info.GetInt32("ActivePolyInd");
			Polygons = (PolygonFlist)info.GetValue("Polygons", typeof(PolygonFlist));
			Category = (CategoryNode)info.GetValue("Category", typeof(CategoryNode));
		}
		public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
		{	//	info.AddValue
			info.AddValue("Name", Name);
			info.AddValue("SearchText", SearchText);
			info.AddValue("ActivePolyInd", ActivePolyInd);
			info.AddValue("Polygons", Polygons);
			info.AddValue("Category", Category);
		}
	}
}
